package com.atguigu.tingshu.search.service;

import co.elastic.clients.elasticsearch.core.SearchRequest;
import co.elastic.clients.elasticsearch.core.SearchResponse;
import com.atguigu.tingshu.model.search.AlbumInfoIndex;
import com.atguigu.tingshu.model.search.SuggestIndex;
import com.atguigu.tingshu.query.search.AlbumIndexQuery;
import com.atguigu.tingshu.vo.search.AlbumSearchResponseVo;

import java.util.Collection;
import java.util.List;
import java.util.Map;

public interface SearchService {


    void upperAlbum(Long albumId);

    void lowerAlbum(Long albumId);

    AlbumSearchResponseVo search(AlbumIndexQuery albumIndexQuery);
    /**
     * 封装检索请求对象
     * @param albumIndexQuery 查询条件
     * @return 检索请求对象
     */
    SearchRequest buildDSL(AlbumIndexQuery albumIndexQuery);

    AlbumSearchResponseVo parseResult(SearchResponse<AlbumInfoIndex> searchResponse,AlbumIndexQuery queryVo);

    List<Map<String, Object>> getTopCategory3HotAlbumList(Long category1Id);

    void saveSuggestIndex(AlbumInfoIndex albumInfoIndex);

    List<String> completeSuggest(String keyword);
    /**
     * 解析建议词结果
     * @param suggestName 自定义建议名称
     * @param searchResponse ES响应结果对象
     * @return
     */
    Collection<String> parseSuggestResult(String suggestName, SearchResponse<SuggestIndex> searchResponse);

    void updateLatelyAlbumRanking();


    List<AlbumInfoIndex> getRankingList(Long category1Id, String dimension);
}
